# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: David Demelier <markand@malikania.fr>
pkgname=libretro-desmume
_pkgname=desmume
pkgver=0_git20220926
pkgrel=0
_commit="fbd368c8109f95650e1f81bca1facd6d4d8687d7"
arch="x86 x86_64 armhf armv7 aarch64"
url="https://github.com/libretro/desmume"
pkgdesc="Nintendo DS core for libretro"
license="GPL-2.0-or-later"
makedepends="libpcap-dev mesa-dev"
source="$pkgname-$_commit.tar.gz::https://github.com/libretro/$_pkgname/archive/$_commit.tar.gz"
builddir="$srcdir/$_pkgname-$_commit"
options="!check" # No tests

build() {
	cd "$builddir"/desmume/src/frontend/libretro
	case "$CARCH" in
		x86|x86_64)
			DESMUME_JIT=1 make
			;;
		armhf|armv7|aarch64)
			DESMUME_JIT=0 DESMUME_JIT_ARM=1 make
			;;
	esac
}

package() {
	install -Dm644 "$builddir"/desmume/src/frontend/libretro/desmume_libretro.so \
		"$pkgdir"/usr/lib/libretro/desmume_libretro.so
}

sha512sums="
300533cee3cd4758b7d114b20b26559eae51511b1918ddf055f7cc5ed5a7062bc2e5ae264817fcf913590ecab6907b719931cbb9a04d96dfd187740da6f6c56e  libretro-desmume-fbd368c8109f95650e1f81bca1facd6d4d8687d7.tar.gz
"
